<?php /*a:3:{s:78:"D:/phpstudy_pro/WWW/stop/public/plugins/aliyunoss/admin/view/config/index.html";i:1669971620;s:58:"D:\phpstudy_pro\WWW\stop\app\admin\view\common\header.html";i:1680353648;s:58:"D:\phpstudy_pro\WWW\stop\app\admin\view\common\footer.html";i:1650617578;}*/ ?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
<title>OneKeyAdmin后台管理系统</title>
<link rel="icon" href="/upload/favicon.ico"> 
<link rel="stylesheet" type="text/css" href="/admin/css/element.min.css?v=<?php echo config('app.version'); ?>">
<link rel="stylesheet" type="text/css" href="/admin/css/onekey.min.css?v=<?php echo config('app.version'); ?>">
<script type="text/javascript" src="/admin/js/jquery.min.js?v=<?php echo config('app.version'); ?>"></script>
<script type="text/javascript" src="/admin/js/vue.min.js?v=<?php echo config('app.version'); ?>"></script>
<script type="text/javascript" src="/admin/js/element.min.js?v=<?php echo config('app.version'); ?>"></script>
<script type="text/javascript" src="/admin/js/sortable.min.js?v=<?php echo config('app.version'); ?>"></script>
<script type="text/javascript" src="/admin/js/vuedraggable.min.js?v=<?php echo config('app.version'); ?>"></script>
<script type="text/javascript" src="/admin/js/common.js?v=<?php echo config('app.version'); ?>"></script>
<script type="text/javascript" src="/admin/js/component.js?v=<?php echo config('app.version'); ?>"></script>
<script type="text/javascript" src="/admin/js/nprogress.js?v=<?php echo config('app.version'); ?>"></script>
</head>
<body>
<div id="app" v-cloak>
	<div class="el-layout">
		<div class="el-pane-warp">
			<el-form ref="config" :rules="rules" :model="config" label-width="200px">
				<el-form-item label="accessKeyId：" prop="accessKeyId">
					<el-input v-model="config.accessKeyId"></el-input>
					<div><a href="https://ram.console.aliyun.com/manage/ak" target="_blank">点击此处查看</a></div>
				</el-form-item>
				<el-form-item label="accessKeySecret：" prop="accessKeySecret">
					<el-input v-model="config.accessKeySecret" show-password></el-input>
					<div><a href="https://ram.console.aliyun.com/manage/ak" target="_blank">点击此处查看</a></div>
				</el-form-item>
				<el-form-item label="bucket名称：" prop="bucket">
					<el-input v-model="config.bucket"></el-input>
					<div><a href="https://oss.console.aliyun.com/bucket" target="_blank">点击此处查看</a></div>
				</el-form-item>
				<el-form-item label="endpoint（地域节点）：" prop="endpoint">
					<el-input v-model="config.endpoint"></el-input>
					<div>yourEndpoint填写Bucket所在地域对应的Endpoint。以华东1（杭州）为例，Endpoint填写为oss-cn-hangzhou.aliyuncs.com。</div>
				</el-form-item>
				<el-form-item label="开启OSS存储：" prop="open">
					<el-switch
						v-model="config.open"
						active-value="1"
						inactive-value="0">
					</el-switch>
					<div>开启OSS云存储后，您上传的文件将保存在云端</div>
				</el-form-item>
			</el-form>
			<div class="el-bottom">
				<el-button 
					size="medium"
					:loading="loading" 
					type="primary" 
					icon="el-icon-refresh-right" 
					@click="save()">
					保 存
				</el-button>
			</div>
		</div>
	</div>
</div>
<script>
	new Vue({
	    el: '#app',
	    data() {
	        return {
	        	url: "aliyunoss/config/index",
	        	config: <?php echo json_encode($config); ?>,
	        	loading: false,
	        	rules: {
	        		accessKeySecret: [
						{ required: true, message: '不能为空', trigger: 'blur' }
					],
					accessKeyId: [
						{ required: true, message: '不能为空', trigger: 'blur' }
					],
					endpoint: [
						{ required: true, message: '不能为空', trigger: 'blur' }
					],
					bucket: [
						{ required: true, message: '不能为空', trigger: 'blur' }
					],
					open: [
	                    { required: true, message: '不能为空', trigger: 'blur' },
	                ],
				},
	        }
	    },
	    methods: {
	        /**
             * 保存基础配置
             */
	        save() {
	        	let self = this;
	        	self.$refs.config.validate((valid) => {
	        		if (valid) {
			        	self.loading = true;
			        	request.post(self.url, { config: self.config}, function(res){
		                    self.loading = false;
		                    self.$notify({showClose: true, message: res.message, type: res.status});
		                });
			        } else {
						return false;
					}
                });
	        },
	    },
	})
</script>
</body>
</html>